//
//  LZHostDetailControllerViewCell.m
//  沙哈拉FM
//
//  Created by dllo on 15/11/8.
//  Copyright © 2015年 S1mpl3. All rights reserved.
//

#import "LZHostDetailControllerViewCell.h"
#import "FitHeader.h"
#import "UIImageView+WebCache.h"
@implementation LZHostDetailControllerViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createView];
        _dataArray = [NSMutableArray array];
    }
    return self;
}

- (void)createView{
    
    _smallLogoImageView = [[UIImageView alloc]init];
    [self.contentView addSubview:_smallLogoImageView];
    
    _nicknameLabel = [[BaseLabel alloc]init];
    _nicknameLabel.textAlignment = 1;
    [_nicknameLabel setFontSize:15];
    [self.contentView addSubview:_nicknameLabel];
    
    _attentionButton = [BaseButton buttonWithType:UIButtonTypeSystem];
    _attentionButton.layer.borderColor = [UIColor redColor].CGColor;
    [_attentionButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    _attentionButton.layer.borderWidth = 1.0;
    [_attentionButton setTitle:@"关注" forState:UIControlStateNormal
     ];
    [self.contentView addSubview:_attentionButton];
}
- (void)layoutSubviews{
    [super layoutSubviews];
    _smallLogoImageView.frame = CGRectMake(0, 0 * FITHeight, self.contentView.frame.size.width, 115 * FITHeight);
    _nicknameLabel.frame = CGRectMake(_smallLogoImageView.frame.origin.x, _smallLogoImageView.frame.origin.y + _smallLogoImageView.frame.size.height + 5 * FITHeight, _smallLogoImageView.frame.size.width, 25 * FITHeight);
    _attentionButton.frame = CGRectMake(25 * FITWidth, _nicknameLabel.frame.origin.y + _nicknameLabel.frame.size.height + 5 * FITHeight, 65 * FITWidth, _nicknameLabel.frame.size.height);
}
- (void)setDic:(NSDictionary *)dic{
    if (_dic != dic) {
        _dic = dic;
    }
    _nicknameLabel.text = [dic objectForKey:@"nickname"];
    [_smallLogoImageView sd_setImageWithURL:[NSURL URLWithString:[dic objectForKey:@"smallLogo"]] placeholderImage:[UIImage imageNamed:@"100*100"]];
}
@end
